package org.nepu.scr.indexrate.converter.drillingrate.keydevice.wellcontrolsystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.wellcontrolsystem.VentFan;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class VentFanConverter implements AttributeConverter<VentFan, String> {
    @Override
    public String convertToDatabaseColumn(VentFan ventFan) {
        return JSONUtil.toJsonStr(ventFan);
    }

    @Override
    public VentFan convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, VentFan.class);
    }
}
